package orest.front.market;

import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import orest.back.userneeds.UserNeedsSql;
import orest.front.market.MarketSql;

import net.ssta.common.Constants;
import net.ssta.common.LoginUser;
import net.ssta.core.base.BaseException;
import net.ssta.core.base.ErrorCode;
import net.ssta.core.base.HandlerBase;
import net.ssta.core.db.DBConnectionProvider;
import net.ssta.core.db.DataBaseExecutor;
import net.ssta.core.db.PagingInfo;
import net.ssta.core.db.Record;
import net.ssta.core.db.RecordSet;
import net.ssta.core.web.RequestKit;
import net.ssta.core.util.DateUtility;


/**
 * 
 * @ClassName: MarketHandler
 * @Description: 需求市场相关处理
 * @author: zhanggk
 * @date: Feb 29, 2012
 * 
 */
public class MarketShowHandler extends HandlerBase
{
    
    /**
     * 获取用户提交的技术需求信息
     */
    public RecordSet getTechneedHomepageShow()
    {
        Connection conn = null;
        RecordSet recordSet = null;
        try
        {
            conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
            DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
            String sql = MarketSql.getTechneedHomePageShowSql();
            recordSet = m_executor.find(sql);
            return recordSet;
        }
        catch (SQLException e)
        {
            throw new BaseException(ErrorCode.DB_EXCEPTION, e);
        }
        finally
        {
            if (conn != null)
            {
                try
                {
                    conn.close();
                }
                catch (SQLException e)
                {
                    throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                }
            }
        }
    }
        
        /**
         * 获取在首页显示的自荐项目
         */
        public RecordSet getSelloneselfHomepageShow()
        {
            Connection conn = null;
            RecordSet recordSet = null;
            try
            {
                conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
                DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
                String sql = MarketSql.getSelloneselfHomePageShowSql();
                recordSet = m_executor.find(sql);
                return recordSet;
            }
            catch (SQLException e)
            {
                throw new BaseException(ErrorCode.DB_EXCEPTION, e);
            }
            finally
            {
                if (conn != null)
                {
                    try
                    {
                        conn.close();
                    }
                    catch (SQLException e)
                    {
                        throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                    }
                }
            }
    }
    
        /**
         * 获取在首页显示的投融资项目
         */
        public RecordSet getInvestHomepageShow()
        {
            Connection conn = null;
            RecordSet recordSet = null;
            try
            {
                conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
                DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
                String sql = MarketSql.getInvestHomePageShowSql();
                recordSet = m_executor.find(sql);
                return recordSet;
            }
            catch (SQLException e)
            {
                throw new BaseException(ErrorCode.DB_EXCEPTION, e);
            }
            finally
            {
                if (conn != null)
                {
                    try
                    {
                        conn.close();
                    }
                    catch (SQLException e)
                    {
                        throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                    }
                }
            }
    }
        
        /**
         * 获取用户提交的技术需求信息
         */
        public RecordSet getTechneedRecommendShow()
        {
            Connection conn = null;
            RecordSet recordSet = null;
            try
            {
                conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
                DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
                String sql = MarketSql.getTechneedRecommendShowSql();
                recordSet = m_executor.find(sql);
                return recordSet;
            }
            catch (SQLException e)
            {
                throw new BaseException(ErrorCode.DB_EXCEPTION, e);
            }
            finally
            {
                if (conn != null)
                {
                    try
                    {
                        conn.close();
                    }
                    catch (SQLException e)
                    {
                        throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                    }
                }
            }
        }
            
            /**
             * 获取在首页推荐显示的自荐项目
             */
            public RecordSet getSelloneselfRecommendShow()
            {
                Connection conn = null;
                RecordSet recordSet = null;
                try
                {
                    conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
                    DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
                    String sql = MarketSql.getSelloneselfRecommendShowSql();
                    recordSet = m_executor.find(sql);
                    return recordSet;
                }
                catch (SQLException e)
                {
                    throw new BaseException(ErrorCode.DB_EXCEPTION, e);
                }
                finally
                {
                    if (conn != null)
                    {
                        try
                        {
                            conn.close();
                        }
                        catch (SQLException e)
                        {
                            throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                        }
                    }
                }
        }
        
            /**
             * 获取在首页推荐显示的投融资项目
             */
            public RecordSet getInvestRecommendShow()
            {
                Connection conn = null;
                RecordSet recordSet = null;
                try
                {
                    conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
                    DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
                    String sql = MarketSql.getInvestRecommendShowSql();
                    recordSet = m_executor.find(sql);
                    return recordSet;
                }
                catch (SQLException e)
                {
                    throw new BaseException(ErrorCode.DB_EXCEPTION, e);
                }
                finally
                {
                    if (conn != null)
                    {
                        try
                        {
                            conn.close();
                        }
                        catch (SQLException e)
                        {
                            throw new BaseException(ErrorCode.CON_NOT_CLOSE, e);
                        }
                    }
                }
        }
}

